package com.haoshuang.zhouzhoubang.ui.page.settled.collaborationcosts

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.StoreYearMoneyBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData


class CollaborationCostsViewModel : BaseViewModel() {

    /**
     * 获取门店支付年费信息
     */
    val getYearMoneyData = StatefulMutableLiveData<ResponseBean<StoreYearMoneyBean>>()
    fun getYearMoney() = netRequest {
        start { getYearMoneyData.value = StateData.Loading }
        request { ApiRepo.getYearMoney()  }
        success { getYearMoneyData.value = StateData.Success(it) }
        error { code, msg ->
            getYearMoneyData.value = StateData.Error(code, msg)
        }
    }

}